import tower from '../../base/tower'
cc.Class({
    extends: tower,

    properties: {},
    initInfo(param,role_info){
        this._super(param,role_info)
        this.attack_status = true
        this.bone = this.tBase.model.findBone("rotate")
    },
    turnDir(pos){
        let degree = this._super(pos)
        this.bone.rotation = -degree
    },
    IdelAction(param){
        this._super(param)
        this.bone.rotation = 0
    },
    attack(param){
        this._super(param)
        let bullet = {
            pos : this.getBulletWorldPos(),           // 初始位置
            damege: this.damege,                // 伤害
            dir: this.v2Target(),               // 方向
            script:this.info.bullet,            // 子弹脚本
            voice: this.info.bulletVoice,       // 子弹声音
            through: this.info.through,
            speed: this.info.bulletSpeed,       // 子弹速度
            collider: this.info.bulletCollider, // 碰撞形状
            attack_fly: true,                   // 是否可攻击空中单位
            style:{                             // 子弹样式
                skin: this.role_info.bulletSkin,
                url:'spine/bullet/' + this.info.bulletModel,
                type:sp.SkeletonData
            },
            effect:[],                          // 子弹效果
        }
        if(this.info.bulletParam && this.info.bulletModel == 'laser'){
            bullet.overtime = parseFloat(this.info.bulletParam)
        }

        bullet = this.getRoleBulletSkill(bullet)  // 通过羊群获得子弹效果        
        if(!bullet.dir.equals(cc.Vec2.ZERO)){
            gg.bulletManager.addBullet(bullet)
        }
    }
});
